/*kZime*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
#define MAXN
using namespace std;
inline int read() {
	int k = 0, f = 1; char c = getchar();
	for(; !isdigit(c); c = getchar())if(c == '-') f = -1;
	for(; isdigit(c); c = getchar()) k = k * 10 + c - '0';
	return k * f;
}

inline char in_char() {
	char c = getchar();
	for(; !isalpha(c); c = getchar());
	return c;
}
 
/*-----------------------------------------------------------------------------*/

int v[3] , m, t, s = 0, step = 0;
char c[100233];

int main() {
#ifndef MYLAB
	freopen("HAOI2013T1.in", "r", stdin);
	freopen("HAOI2013T1.out", "w", stdout);
#else
	freopen("in.txt", "r", stdin);
#endif
	m = read();
	t = read();
	for(int i = 0; i <= 2; i++) {
		v[i] = read();
	}
	
	for(int i = 0; i < t; i++) {
		c[i] = in_char();
	}
	
	while(s <= m && step <= t) {
		if(c[step] != 'f') {
			s += v[0] + v[2];
		}
		else {
			s += v[1] << 1;
		}
		step++;
	}
	
	printf("%d",--step);
	
	return 0;
}
